home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / a_man / cat1 / swap.z / swap
Encoding:
Text File  |  2002-10-03  |  24.3 KB  |  397 lines

  1.  
  2.  
  3.  
  4. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      _ssss_wwww_aaaa_pppp - swap administrative interface
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _[[[[_----_iiii_]]]]_[[[[_----_pppp_p_r_i_]]]]_[[[[_----_vvvv_v_l_e_n_]]]] _n_a_m_e _[[[[_l_o_w _[[[[_l_e_n_]]]]_]]]]
  13.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_dddd _n_a_m_e/_l_s_w_a_p _[[[[_l_o_w_]]]]
  14.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_llll _[[[[_----_nnnn_]]]]_[[[[_----_ffff_]]]]_[[[[_----_bbbb_]]]]
  15.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_ssss _[[[[_----_bbbb_]]]]
  16.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_mmmm
  17.      _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_uuuu
  18.  
  19. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.      _ssss_wwww_aaaa_pppp provides a method of adding, deleting, and monitoring the system
  21.      swap areas used by the memory manager.  The following options are
  22.      recognized:
  23.  
  24.      _----_aaaa   Add the specified swap resource.  _n_a_m_e is the name of the block
  25.           special partition, for example, _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 or a regular file.
  26.           Files on NFS mounted file systems are also permitted (see SSSSwwwwaaaappppppppiiiinnnngggg
  27.           ttttoooo NNNNFFFFSSSS FFFFiiiilllleeeessss below).  _l_o_w is the offset in 512-byte blocks into the
  28.           partition/file where the swap area should begin.  If _l_o_w is absent,
  29.           a default of 0 is used.  This value is rounded up to a multiple of
  30.           the system defined swap page size.  _l_e_n is the length of the swap
  31.           area in 512-byte blocks.  If _l_e_n is absent, the new swap area will
  32.           use the entire partition/file.  This value is rounded down to a
  33.           multiple of the system defined swap page size.  Files used as swap
  34.           devices must exist and have been previously grown to the appropriate
  35.           size (see _mmmm_kkkk_ffff_iiii_llll_eeee(1m)).  A maximum of 255 swap resources can be
  36.           active at a given time.  This option can only be used by a
  37.           privileged user.
  38.  
  39.           Swap areas are normally added by modifying the _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb file to
  40.           contain the various files and partitions that should be added when
  41.           the system is booted.
  42.  
  43.           When using the _----_aaaa or _----_mmmm option, _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb is scanned for an entry
  44.           whose _t_y_p_e field contains _ssss_wwww_aaaa_pppp and whose _f_i_l_e_s_y_s_t_e_m field matches
  45.           _n_a_m_e.  _n_a_m_e is made into a full path name.  If an entry is found in
  46.           _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb, any supplied options are used to supplement any options
  47.           given on the command line (e.g. priority).
  48.  
  49.      _----_iiii   Ignore safety checks.  Normally, when adding a block special device
  50.           as a swap resource, a check is made to try to be certain that the
  51.           block device does not overlap any existing file systems.  This
  52.           option turns off that check.
  53.  
  54.      _----_pppp _p_r_i
  55.           Swap resources have a priority between 0 and 7 inclusive where lower
  56.           priority swap resources are allocated from first.  Within a
  57.           priority, allocations are done round-robin.  By default, block
  58.           devices are assigned a priority of 0, files on local file systems
  59.           are assigned a priority of 2 and files on NFS mounted file systems
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  71.  
  72.  
  73.  
  74.           are assigned a priority of 4.  This option is only valid when adding
  75.           a swap resource.
  76.  
  77.      _----_vvvv _v_l_e_n_g_t_h
  78.           Set the virtual length of the swap area to _v_l_e_n_g_t_h.  Normally, if
  79.           this field is not specified, the amount of logical swap is increased
  80.           by the size of the physical swap device being added.  This option
  81.           tells the system to increase the logical swap amount by _v_l_e_n_g_t_h.
  82.           Thus, the difference between _v_l_e_n_g_t_h and the actual size of the
  83.           device is amount of _v_i_r_t_u_a_l swap that is added.  The virtual length
  84.           must be greater than or equal to the physical length of the swap
  85.           area.  If not specified, the virtual length is set equal to the
  86.           actual length.  See _ssss_wwww_aaaa_pppp_cccc_tttt_llll(2) for a discussion on virtual swap
  87.           spaces.  In general, this option should only be used when there is
  88.           no other way to get enough swap resources (even via NFS) and it is
  89.           understood the potential problems creating virtual swap can cause.
  90.           See the discussion of Logical Swap Space below.
  91.  
  92.      _----_dddd   Delete the specified swap resource.  _n_a_m_e is the name of block
  93.           special partition, for example, _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 or a regular file.
  94.           If _n_a_m_e starts with a digit, it is interpreted as the logical swap
  95.           number of the device to be deleted.  This is useful when the file or
  96.           device directory entry has been inadvertently been removed.  _l_o_w is
  97.           the offset in 512-byte blocks into the swap area to be deleted.  If
  98.           not specified, a default of 0 is used.  Using this option marks the
  99.           swap area as ``INDEL'' (in the process of being deleted).  The
  100.           system will not allocate any new blocks from the area, and will try
  101.           to free swap blocks from it.  The area will remain in use until all
  102.           blocks from it are freed.  This option can be used only by a
  103.           privileged user.
  104.  
  105.      _----_mmmm   Add all swap resources specified in _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb ( _t_y_p_e field is
  106.           sssswwwwaaaapppp).  An entry with the name ////ddddeeeevvvv////sssswwwwaaaapppp is ignored, as are all
  107.           entries with the nnnnooooaaaauuuuttttoooo option present.  This option is primarily
  108.           for the system start up script _////_eeee_tttt_cccc_////_iiii_nnnn_iiii_tttt_...._dddd_////_ssss_wwww_aaaa_pppp which, at boot time,
  109.           adds all the administrator configured swap resources.  This option
  110.           can be used only by a privileged user.
  111.  
  112.      _----_uuuu   Delete all swap resources except the original boot swap resource.
  113.           This option is primarily for the system shutdown script
  114.           _////_eeee_tttt_cccc_////_iiii_nnnn_iiii_tttt_...._dddd_////_ssss_wwww_aaaa_pppp which, at system shutdown time, deletes all the
  115.           configured swap resources.  The original boot swap resource may be
  116.           explicitly deleted using the ----dddd option.  This option can be used
  117.           only by a privileged user.
  118.  
  119.      _----_llll   List the status of all the swap areas.  The output has either seven
  120.           or nine columns depending on various options.  By default, the
  121.           listing contains nine columns and all values are in 512 byte blocks.
  122.           The _----_nnnn option enables a new easier to read output format which
  123.           defaults to printing the important seven columns (the additional two
  124.           columns are printed if the _----_ffff option is specified).  Values with the
  125.           _----_nnnn option are printed in either bytes, or with the _----_bbbb option, in
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  137.  
  138.  
  139.  
  140.           512-byte blocks.  The _----_ffff and _----_bbbb options are only recognized when the
  141.           new output format is specified.
  142.  
  143.           _####       The logical swap number.  This ranges from 1 to 255.  This
  144.                   is column is labeled _llll_ssss_wwww_aaaa_pppp in the default listing format.
  145.  
  146.           _pppp_aaaa_tttt_hhhh    The path name for the swap area.
  147.  
  148.           _dddd_eeee_vvvv     The major/minor device number in decimal.  This is printed
  149.                   in the default list format or in the new format if the _----_ffff
  150.                   option is present.  If the swap resource is a block special
  151.                   device, this major/minor pair refers to the special device
  152.                   itself.  If the swap resource is a regular file, the
  153.                   major/minor number is for the underlying file system that
  154.                   the file resides on.  If the _s_t_a_t(2) on _pppp_aaaa_tttt_hhhh fails, '?,?' is
  155.                   printed.
  156.  
  157.           _pppp_rrrr_iiii     The priority of the swap resource.
  158.  
  159.           _ssss_wwww_aaaa_pppp_llll_oooo  The _s_w_a_p_l_o_w value for the area in 512-byte blocks.  This is
  160.                   printed in the default list format or in the new format if
  161.                   the _----_ffff option is present.  This value is rounded up to a
  162.                   multiple of the system defined swap page size.
  163.  
  164.           _pppp_ssss_wwww_aaaa_pppp   The _s_w_a_p_l_e_n value for the area.  This value is rounded down
  165.                   to a multiple of the system defined swap page size.  This is
  166.                   column is labeled _bbbb_llll_oooo_cccc_kkkk_ssss in the default listing format.
  167.  
  168.           _ffff_rrrr_eeee_eeee    The amount of free swap in the area.
  169.  
  170.           _mmmm_aaaa_xxxx_ssss_wwww_aaaa_pppp The maximum size the area will be grown to.
  171.  
  172.           _vvvv_ssss_wwww_aaaa_pppp   The size over and above any physical space that the system
  173.                   is assuming it can use (see the discussion of logical swap
  174.                   space below, and the _----_vvvv option above).
  175.  
  176.           There are four status flags that may be printed after the last
  177.           column.  Normally functioning swap resources will not have any
  178.           status flags.  These flags are:
  179.  
  180.           _IIII_NNNN_DDDD_EEEE_LLLL   The swap area is being deleted.  No allocations will be made
  181.                   from this device.
  182.  
  183.           _EEEE_AAAA_CCCC_CCCC_EEEE_SSSS  The swap area was on an NFS mounted file system and 'root'
  184.                   does not have permission to write the file.  The swap area
  185.                   is immediately taken off line.
  186.  
  187.           _EEEE_SSSS_TTTT_AAAA_LLLL_EEEE  The swap area was on an NFS mounted file system and the file
  188.                   was removed on the NFS server.  The swap area is immediately
  189.                   taken off line.  Processes with pages on the swap area will
  190.                   be terminated abnormally the first time they attempt to
  191.                   access any page that had been stored on the swap area.
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  203.  
  204.  
  205.  
  206.           _IIII_OOOO_EEEE_RRRR_RRRR   An I/O error occurred on the device.  This could result in
  207.                   the abnormal termination of a process.  Look in
  208.                   ////vvvvaaaarrrr////aaaaddddmmmm////SSSSYYYYSSSSLLLLOOOOGGGG for more details.  Even with I/O errors, the
  209.                   swap area is still allocated from and used until deleted.
  210.  
  211.      _----_ssss   Print information about total logical swap space usage.  Values are
  212.           printed in either bytes, or with the _----_bbbb option, in 512-byte blocks.
  213.  
  214.           _aaaa_llll_llll_oooo_cccc_aaaa_tttt_eeee_dddd   The amount of swap space allocated to private pages.
  215.  
  216.           _rrrr_eeee_ssss_eeee_rrrr_vvvv_eeee_dddd    The amount of swap space not currently allocated, but
  217.                       claimed by private memory mappings.
  218.  
  219.           _uuuu_ssss_eeee_dddd        The total amount of logical swap space that is either
  220.                       allocated or reserved.
  221.  
  222.           _aaaa_vvvv_aaaa_iiii_llll_aaaa_bbbb_llll_eeee   The total logical swap space that is currently available
  223.                       for future reservation and allocation.
  224.  
  225. SSSSWWWWAAAAPPPPPPPPIIIINNNNGGGG TTTTOOOO NNNNFFFFSSSS FFFFIIIILLLLEEEESSSS
  226.      Swapping to regular files on NFS mounted file systems is permitted but
  227.      should be done only with hard mounted file systems with the _i_n_t_r option
  228.      turned off (see _ffff_ssss_tttt_aaaa_bbbb(4)).  When using either soft mounted file systems
  229.      or the _i_n_t_r option, NFS may return an error during a swap I/O operation.
  230.      An I/O error that occurs when swapping in a page causes the process
  231.      requesting the page to be killed, since it's address space is no longer
  232.      accessible.  Since it is possible for the _iiii_nnnn_iiii_tttt process to be swapped out
  233.      to the NFS file, a timeout from a soft mounted file system that occurs
  234.      while the system is swapping in a page for _iiii_nnnn_iiii_tttt will cause _iiii_nnnn_iiii_tttt to die.
  235.      Since the system is unable to run without _iiii_nnnn_iiii_tttt, the system will in turn
  236.      panic.  Using hard mounted file systems without the _i_n_t_r flag avoids
  237.      these problems.
  238.  
  239.      Even when using hard mounted NFS file systems, the system may appear to
  240.      hang if the NFS server fails to respond.  If the window manager, shell,
  241.      or other key process is swapped out to the NFS file and the server fails
  242.      to respond during swap-in, then the system will wait and retry the NFS
  243.      file read indefinitely.  During this time, programs attempting to swap-in
  244.      pages from that server will not run and will appear to be hung.  Once the
  245.      NFS server starts responding again, normal system activity will resume.
  246.  
  247.      Finally, the system administrator must ensure that the swap file on the
  248.      NFS server is not deleted.  This would cause subsequent swap-ins to fail
  249.      and again cause the associated processes to be killed.
  250.  
  251. LLLLOOOOGGGGIIIICCCCAAAALLLL SSSSWWWWAAAAPPPP SSSSPPPPAAAACCCCEEEE
  252.      Logical swap space is the sum total of physical memory (less space
  253.      occupied by the kernel) and all swap devices.  The system reserves
  254.      logical swap space for the private portions of a process's virtual
  255.      address space (data, bss, stack, MAP_PRIVATE mmap mappings, etc.) when
  256.      virtual address spaces are created (via _ffff_oooo_rrrr_kkkk(2)), when they are grown
  257.      (via _bbbb_rrrr_kkkk(2), _ssss_bbbb_rrrr_kkkk(2), or _mmmm_aaaa_llll_llll_oooo_cccc(3C)), or when new segments are attached
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  269.  
  270.  
  271.  
  272.      (via _mmmm_mmmm_aaaa_pppp(2), or _ssss_hhhh_mmmm_aaaa_tttt(2)).  Logical swap space is not required for
  273.      shared text or MAP_SHARED mapped files (except for mappings of the
  274.      /_d_e_v/_z_e_r_o device).  If the amount of private virtual space requested
  275.      exceeds the available logical swap space, the system call fails with
  276.      EAGAIN and an "out of logical swap space" message is logged on the
  277.      console.  The system does this in order to prevent memory deadlocks from
  278.      occurring.
  279.  
  280.      Note that the system may report being out of swap space when the _----_llll
  281.      option shown above reports free swap space available.  This happens when
  282.      the logical swap space has been reserved, but physical space has not yet
  283.      been allocated, so the blocks are still marked as being free.  The _----_ssss
  284.      option to the _ssss_wwww_aaaa_pppp command will report the amount of logical swap space
  285.      reserved and allocated.
  286.  
  287.      Programs that have large address spaces and large programs that fork, may
  288.      receive EAGAIN along with the "out of logical swap space" message on the
  289.      console.  This can also happen when debugging a large program with _dddd_bbbb_xxxx or
  290.      other debugger.  There are two ways to avoid this error: adding more real
  291.      swap space, or adding virtual swap space.  Adding real swap space means
  292.      allocating an additional disk partition or a regular file (either local
  293.      or remote via NFS) to be used as a swap device (using the _----_aaaa option shown
  294.      above and the examples below).  This is the required approach for
  295.      programs that use most of the virtual addresses they allocate.  The
  296.      advantage of this approach is that it continues to avoid memory
  297.      deadlocks, but requires physical disk space to be allocated.
  298.  
  299.      The alternative is to add virtual swap space using the _----_vvvv option.  This
  300.      increases the amount of logical swap space without using any physical
  301.      disk space.  This is suitable when the programs involved do not intend to
  302.      use the virtual address space they allocate (i.e., when the address space
  303.      is sparse or when a large program that forks intends to exec soon
  304.      afterwards without modifying many pages).  In these cases, physical swap
  305.      space is not required and so adding virtual swap space allows the kernel
  306.      to complete the logical swap space reservation and avoid the EAGAIN
  307.      errors.  The advantage of this approach is that it does not require any
  308.      disk space, but adds the risk of encountering a memory deadlock.  Memory
  309.      deadlocks occur when the system has over-committed logical swap space by
  310.      allowing the total private virtual space of the processes on the system
  311.      to exceed real swap space.  When processes attempt to use the allocated
  312.      virtual space, the kernel has no place to store the data (since virtual
  313.      swap space has no associated disk space), and a memory deadlock results.
  314.      In these instances, the kernel kills one or more processes to free up
  315.      enough logical swap space to break the deadlock.  For this reason,
  316.      virtual swap space should not be used in cases where the program will
  317.      attempt to use the memory.  For example, programs that expect _mmmm_aaaa_llll_llll_oooo_cccc(3C)
  318.      to return _NNNN_UUUU_LLLL_LLLL when there is no more memory will in fact be allocated
  319.      virtual memory that they could not use without causing a memory deadlock.
  320.      The _----_vvvv option should therefore be used with care.
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. sssswwwwaaaapppp((((1111MMMM))))                                                              sssswwwwaaaapppp((((1111MMMM))))
  335.  
  336.  
  337.  
  338. NNNNOOOOTTTTEEEESSSS
  339.      The ability to request that a swap resource be automatically grown has
  340.      not been implemented.
  341.  
  342. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  343.      The following _ssss_wwww_aaaa_pppp example requests 10K of swap area (twenty 512-byte
  344.      blocks) on the device _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111:
  345.  
  346.           _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _////_dddd_eeee_vvvv_////_dddd_ssss_kkkk_////_dddd_kkkk_ssss_0000_dddd_1111_ssss_1111 _0000 _2222_0000
  347.  
  348.      The following adds 50Mb of swap space to the system using a file in the
  349.      /_s_w_a_p directory:
  350.  
  351.           _////_uuuu_ssss_rrrr_////_ssss_bbbb_iiii_nnnn_////_mmmm_kkkk_ffff_iiii_llll_eeee _5555_0000_mmmm _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111
  352.  
  353.           _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111
  354.  
  355.      To make this swap area permanent (automatically added at boot time) add
  356.      the following line to /_e_t_c/_f_s_t_a_b:
  357.  
  358.           _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111 _ssss_wwww_aaaa_pppp _ssss_wwww_aaaa_pppp _pppp_rrrr_iiii_====_3333 _0000 _0000
  359.  
  360.      The following example adds the regular file _ssss_wwww_aaaa_pppp_1111 as a swap resource.
  361.      Its priority is set to 5, and the system is told that it should add 100
  362.      Mbytes (204800 512-byte blocks) to the virtual swap total.  The example
  363.      assumes that _ssss_wwww_aaaa_pppp_1111 is less than 100 Mbytes in length:
  364.  
  365.           _////_ssss_bbbb_iiii_nnnn_////_ssss_wwww_aaaa_pppp _----_aaaa _----_pppp _5555 _----_vvvv _2222_0000_4444_8888_0000_0000 _ssss_wwww_aaaa_pppp_1111
  366.  
  367.      The following line in _////_eeee_tttt_cccc_////_ffff_ssss_tttt_aaaa_bbbb will add the same swap resource as the
  368.      previous example, except that it will occur automatically at system
  369.      startup time:
  370.  
  371.           _////_ssss_wwww_aaaa_pppp_////_ssss_wwww_aaaa_pppp_1111 _ssss_wwww_aaaa_pppp _ssss_wwww_aaaa_pppp  _pppp_rrrr_iiii_====_5555_,,,,_vvvv_llll_eeee_nnnn_gggg_tttt_hhhh_====_2222_0000_4444_8888_0000_0000 _0000 _0000
  372.  
  373. FFFFIIIILLLLEEEESSSS
  374.      /etc/fstab     swap and/or vswap to add at system boot
  375.      /etc/config/vswap.options     sets default size of virtual swap at boot
  376.      /etc/init.d/swap    adds/removes swap and/or vswap at boot/shutdown
  377.  
  378. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  379.      mkfile(1M), mount(1M), swapctl(2), fstab(4).
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.